//
//  SectionTwoCell.m
//  halfSweat
//
//  Created by 甘伟杰 on 16/5/14.
//  Copyright © 2016年 ganweijie. All rights reserved.
//

#import "SectionTwoCell.h"
#import <UIImageView+WebCache.h>

@implementation SectionTwoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

//+ (instancetype) viewForNib {
//    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
//}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    // 布局图标
    CGFloat imageViewX = 10;
    CGFloat imageViewY = 2;
    CGFloat imageViewW = 40;
    CGFloat imageViewH = imageViewW;
    self.imageView.frame = CGRectMake(imageViewX, imageViewY, imageViewW, imageViewH);
    
    // 布局标题文字
    CGFloat titleX = CGRectGetMaxX(self.imageView.frame) + 10;
    CGRect titleRect = self.textLabel.frame;
    titleRect.origin.x = titleX;
    self.textLabel.frame = titleRect;
}

- (void)setItem:(RowItem *)item {
     _item = item;
    NSLog(@"%@ --- %@", item.iconImage,item.cellTitle);
    
    self.imageView.image = item.iconImage;
    self.textLabel.text = item.cellTitle;
}


@end
